<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>阿呆社区</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" th:href="@{/css/bootstrap.min.css}">
    <link rel="stylesheet" th:href="@{/css/bootstrap-theme.min.css}">
    <link rel="stylesheet" th:href="@{/css/ardai.css}">
    <link rel="shortcut icon" th:href="@{/img/shotcut.png}">
    <script th:src="@{/js/jquery-3.4.1.js}"></script>
    <script th:src="@{/js/bootstrap.min.js}"></script>

</head>
<body>
<nav class="navbar navbar-default">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">阿呆社区</span>
            </button>
            <a class="navbar-brand" th:href="@{/list}">Ardai</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <form class="navbar-form navbar-left">
                <div class="form-group">
                    <input type="text" class="form-control" placeholder="Search">
                </div>
                <button type="submit" class="btn btn-default">搜索问题</button>
            </form>
            <ul class="nav navbar-nav navbar-right">
                <li th:if="${session.user==null}"><a th:href="@{/toLogin}">登陆</a></li>
                <li th:if="${session.user!=null}" class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><img th:src="@{${session.user.avatar}}" style="width: 40px;border-radius: 50%"/> <span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li><a href="#">消息中心</a></li>
                        <li><a th:href="@{/toAddPost}">发布帖子</a></li>
                        <li><a th:href="@{/userInfo(uid=${session.user.id})}">个人资料</a></li>
                        <li><a th:href="@{/logout}">退出登陆</a></li>
                    </ul>
                </li>
            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>
<div class="container-fluid main">
    <div class="row">
        <div class="col-lg-9 col-md-12 col-sm-12 col-xs-12">
            <h2><span class="glyphicon glyphicon-plus" aria-hidden="true"></span>帖子发布</h2>
            <hr>
            <form th:action="@{/addPost}" method="post" enctype="multipart/form-data">
                <div class="form-group">
                    <label for="title">帖子标题(简单概要)</label>
                    <input type="text" name="title" class="form-control" id="title" placeholder="帖子标题...">
                </div>
                <div class="form-group">
                    <label for="postImg">帖子附图(要求图片<=1024KB不然报错)</label>
                    <input type="file" class="form-control" name="postImg" id="postImg" placeholder="帖子附图...">
                </div>
                <div class="form-group">
                    <label for="desc">帖子内容(必填，请参照提示)</label>
                    <textarea name="content"  class="form-control" id="desc" cols="30" rows="10"></textarea>
                </div>
                <div class="form-group">
                    <label for="typeId">分类</label>
                    <select class="form-control" id="typeId" name="typeId">
                        <option  th:each="type:${types}" th:text="${type.name}" th:value="${type.id}">1</option>
                    </select>
                </div>
                <div class="form-group">
                    <label for="tag">标签(按住Ctrl可以进行多选)</label>
                    <select class="form-control" id="tag" name="tags"  multiple>
                        <option  th:each="tag:${tags}" th:text="${tag.name}" th:value="${tag.id}">1</option>
                    </select>
                </div>
                <button type="submit" class="btn btn-publish btn-success">发布</button>
            </form>
        </div>
        <div class="col-lg-3 col-md-12 col-sm-12 col-xs-12">
            <h3>帖子发起指南</h3>
            =>帖子标题：请用简洁的语言描述你发布的标题，不超过50个字 <br>
            =>帖子内容：在里面对你详细内容进行编写，必要时提供相关资料 <br>
            =>帖子分类：选择你觉得适合的分类 <br>
            =>帖子标签：选择一个或多个合适的标签 <br>
        </div>
    </div>
</div>
</body>
</html>